package com.example.boot6rabbitmq.controller;

import com.example.boot6rabbitmq.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 只管消息发送
 */
@RestController
public class MessageController {

    @Autowired
    MessageService messageService;

    @RequestMapping("/send/{num}/{msg1}/{msg2}")
    @ResponseBody
    public String send(@PathVariable int num, @PathVariable String msg1, @PathVariable String msg2){
        messageService.send(num,msg1,msg2);
        System.out.println("send message !");
        return  "send message !";
    }

    @RequestMapping("/send1/{num}/{msg1}/{msg2}")
    @ResponseBody
    public String send1(@PathVariable int num, @PathVariable String msg1, @PathVariable String msg2){
        messageService.send1(num,msg1,msg2);
        System.out.println("send1 message !");
        return  "send1 message !";
    }


}
